﻿using Customer.Domain;
using Customer.Infrstructre.CusContactManager;
using Customer.Read.API.Applcation.Command.CusContactCommand;
using MediatR;

namespace Customer.Read.API.Applcation.CommandHandler.CusContactCommandHandler
{
    /// <summary>
    /// 反填客户联系人
    /// </summary>
    public class FantCusContactCommandHandler:IRequestHandler<FantCusContactCommand,CusContact>
    {
        private readonly ICusContactRepository _cusContactRep;

        public FantCusContactCommandHandler(ICusContactRepository cusContactRep)
        {
            this._cusContactRep = cusContactRep;
        }

        public async Task<CusContact> Handle(FantCusContactCommand request, CancellationToken cancellationToken)
        {
            return await _cusContactRep.GetModelAsync(request.CusContactId);
        }
    }
}
